﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

public partial class ajax_sort_topic10 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string result = "<table width=100% id=\"top10\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style='BORDER-COLLAPSE: collapse;font-size: 11pt;' bordercolor=\"#cfdfff\" align=\"center\">";

        result += "<tr>";
        result += "<td align=center width=30>排名</td><td align=left>话题</td><td align=center width=70>回复/点击</td>";
        result += "</tr>";
        result += "<tbody>";
        int orderby = 1;
        string sSql = "select top 10 topic_title,topic_forums,topic_hit,topic_time from t_bbs_topic where topic_flag=0 order by topic_forums desc";
        TSqlDBReader oTop10 = new TSqlDBReader(sSql);
        while (oTop10.FDataReader.Read())
        {
            DateTime topic_time = (DateTime)oTop10.FDataReader.GetValue(oTop10.FDataReader.GetOrdinal("topic_time"));

            result += "<tr>";
            result += "<td align=center width=30>" + orderby.ToString() + "</td>";
            result += "<td align=left><a href=\"easybbs.aspx\">" + oTop10.FDataReader.GetValue(0).ToString() + "</a>";
            TimeSpan ts = DateTime.Today - topic_time;
            if (ts.TotalDays < 7)
            {
                result += "<img src=\"./images/new01.gif\" border=0></td>";
            }
            else
            {
                result += "</td>";
            }
            
            result += "<td align=center width=70>" + oTop10.FDataReader.GetValue(1).ToString() + "/" + oTop10.FDataReader.GetValue(2).ToString() + "</td>";
            result += "</tr>";

            orderby++;
        }
        oTop10.Free();
        result += "</tbody>";

        result += "</table>";

        top10.Text = result;
    }
}
